Fixed problem with NUll pointer