Fixed NPE issues post making changes to main classes and examples.