Removes redundant cast in samplers.