Ensure mapping matrix size is always valid.