fixed possible NPE
updated version