Fix #3372 check for valid server

Fix #3374 

Also, made a small refactoring to live dev startup to create live document before agents load.