Fixed wrong variable used