Fixed wrong variable name and reduced ram usage