more thread safe, quit actually works