A few fixes from @alexbennett