some fixes as per oded comments