script improvements

Fixes the problem when deducing type from test agents
This is the same as #24 (that one wasn't able to be merged)