fixing flag handling, fixing pacemaker check