fixing typeof undefined for debug mode