fixed nullpointer excpetions