fixed ar sql script