library is not thread safe, fixed example