fixed compiler errors, added debugging stuff