fixed nil issues