replaced lib/debug by debug module
fixed jshint erros