fixed empty queue case in score function