My attempt to fix the small bug led to a bigger bug, so changing it back.