corrected bug found by Nikos