Fixed bugs appearing in production mode