fix order of angle calculations