make thread safe

Signed-off-by: Andreas Zöllner <andi@go-for-fun.de>