Replicate fix for max into template for min.

Tracker item 3731