NPE Fix Feature Branch

NPE fixes from rSmart/issues#243