added piecewise option and fixed NPE in WALACFGUtil