Add tests to avoid NullExceptions