fix uninitialized value access / NULL pointer access (not sure why the former is not reported as a compiler warning)