More attempts at fixing this really annoying bug