some printf-debugging code added
typo fixes + printf-debugging