fixed a few NPEs