variable missing when fit throws error