More error handling,

make sure to never get null pointers.