fixed the nullPointerException