Fixed database staying open problem and some parser bugs