Fix crashing when database is locked.
Add debug code for VMHR.
Add handler of attach image from clipboard.