stupid bug in my code
(if (!ret) { fail; } instead of if (ret) { fail; })