Fix nullPointerException error at sort feature