Fix warnings on LLVM
Fix piecewise curve problem turned up by llvm