Fixed out of memory bug