Merge pull request #23 from breber/crash

Prevent crash when trying to open database