fixes and debug statements