enforcing type safety; checking and correcting tests (NullPointerExceptions)