trying to solve nans in rotation