fixed null pointer problem