fix bug when returning multiple last values