Fixed #11 added check for array before calling replacement function
apply/call