Fix index error in quat