fix the nullreferenceException error