fix a bug in optimized min