fixing quotes and adding missing 'then'