Attempt to fix Mac OS, misc. fixes

Still can't quite get it working yet, but here's what I've got so far.