Fix bug by changing order