Fixed some NRE issues