correct 500 errors when displaying invoice's PDF