fixes as per @JohnSimmons comments