Fix NPE
Adjust exception handling and reporting