Misc AVM1 fixes

This all is functionally identical to what was there before, right? (Just checking to make sure I'm not overlooking something.)