fixed several small bugs.
fixed improper test case generation, missing functino parametre