Some minor improovements and fixes