refactoring
fixed nullpointerexception
fixed nullpointerexception