quick hack, use a mutex