Check that term is a list before attempting to access it.
Define -type t/1 using it's runtime representation :(

So that Dialyzer can track the parameter it was initialized with...
Fix incorrect specs.