added production check
fixed function definition