fix environment_needs_upgrade (no db.rollback needed)
add changes for autocreatetable fix