fixed hearbeat not set properly, small reactorings