Fixed shape of output in rotate_data and changed/hacked its error catching.