Fixed replication problem reported by Rick. Transformed the internal thread msg queue in a Lock + Condition