Fixed Some null pointers

There are more but it looks like its working a little.