kind of faulty behavior added to match the c-code