- added some sanity checks and removed a debug message