Fixes #1168 - Calling 'last' on empty collection throws BadInputException