not correct algo, without sigsegv