Database script fixes