fixed speed bug in update function