Cool, this helped tremendously.
I found that there were 2 users that had no permissions whatsoever. After adding one permission each to each user, then I reverted back to the original code on class.export.php and then was able to export accordingly.
Seems that when there are no permissions for even just one agent, then exporting won't work.
I hope that this will help when correcting the code or, if the agent doesn't need permissions, then why even still keep them in the system, my thought is to keep the agent information tied to tickets/replys/internal notes.