Updating for deprecation of to_binary in some scenarios.