fixed 2 null pointer exceptions