fix error when sorting role