fixing bugs spotted by Seth, Julie and Inna