fixed defects in graph cuts

@iglesias @tklein23 @hushell 
Fixed new defects reported by Coverity Scan.