Compiler fixes

@washort, I'd like feedback on the second of these changes, since it changes the semantics of compiled code quite a bit.