Fix for subtle but EXTREMELY annoying bug