Make sure trims are within min/max

Fix Issue #1123