removed possible invalid pointer access