fixes bug within agent handler regarding heartbeat