Fix null exception
Possible resolution for #8