Fixes to graphcut