Fixed auto-reinstall of database