fixed one bug, didn't set the memory to 0 in create_query. so it may
have segment falt(some times) [becuase the next of the query may not be
null]