Bug fix on sorting activity