enabling debug statements and fixed some minor bugs