Made compilable on my system
Added Debug output