Fixed patients.csv and some other SQL script bugs