fixed bug spotted by misof