Fix some database bugs and install picture library