Merge fixes from fonnesbeck:master