corrections and debug