Fixed codes not replaced in quotes and issues with inv. spaces