Fixed memory bug (seqfault with big memory consumption)