Small fixes and some debug statements