Various fixes -- still work in progress