fix replace
Detect array of objects.

Closes #5