a couple of fixes as per @contra