added protection against NPE