Incorporated fix by @dtewfik for better table sorting.