Fix some interop bugs, preparing to implement GUI