fix calculating rotation

fix calculating rotation