avoid possible NPE and tidied up docs