moved cout lock stuff to common