for Jordan fixed a problem with the getPreviousOrder function