adding Mote's patch to fix ranged attacks