fixes as per AlexKlim comment