fix completed logic