better handling of potential NPE