added protection against NULL pointer