NPE Exceptions fixed