cleanup and use real min/max values