index wasn't escaped properly for mysql

Also properly quoted run names with spaces