fixin a few null pointer errors