changed console.debug to console.error