fixed numerous null pointers