Fixed errors with db script, updated the order