Fixed null pointer exception bug in retrieving hospital agent