Updating `length` to handle strings too.