Fix Apply method to not throw an exception when the object is a string