Fix some more issues

Ah, I see. I've played around and have a way to make it work for signed values, see http://pastebin.com/j4zz7P6i