Threadsafe

Signed-off-by: Clienthax <clienthax@gmail.com>