Small corrections and debug outputs