removes paired quotes; deals with the situation that balance quotes teminated unexpectly; fixes #5