Replace deprecated methods.

Resolves #1033.