Fix invoice sorting