Some minor cleanups and fixes