fixed bug that would cause this to always exit