solved bug in log sorting