fixing falling algorithm