fixed nil pointer