Add test and fix bug in setVal
Fix a bunch of bugs with setval and multiplication