algorithm fixes...