Fixed little bugs, set cal min/max using histogram