adding some initial debugging printout
first bugfixes