fixed memory leaks and random SIGSEGVs
engine version 1.0.4
fixed up setting command errors in cli wrapper