Fix sort
Fix logging.