finish tests; fix function errors