Prevent segfault when readline returns NULL.
More fixes to prevent segfaults when an End Station is not fully enumerated.
Fix so that the correct notification id value is used.
Use local variables where possible (uncovered incorrect variable use bugs).