Fixed ham cin and some bugs.