Some inital fixes

You might want to cherry-pick or I can make separate pull-requests if you want.