Fixed nested quotes not being properly escaped

This addresses the immediate problem from #264