refacor according to patch code