fix command loop