Protect against NPE exceptions