fixed jittering. Using cout instead of cerr