fixed null pointer exceptions