try to play well with perl threads