Fixed mismatched variable names
Only log if WORM_DEBUG environment variable is set