When my code works in test environment, but throws many errors in production