added runtime type checking of parameters