fixed some problems with functions
no longer throws exceptions for invalid simulations
fixed bug in argument passing