Fixed wrong variable bug