Added check for start and end column in table sort