RELOAD-293 Fixes server crash + minor code cleanup.