did wrong algorithm by mistake. fixed