race condition fixed, existinc cid handling has to be improved