fix nil issues