moved debug output to stderr