Thread safety

this also needs to be synchronized to protect internal state