ops... was forgetting than in debug mode the value of levelcell at the moment of the error was 0, not nil, so the revised code hasn't helped...