fixing ray bug