fixed bug with NullPointerExeption