Fix Exception handling and print issues