Bugfix: moving parameter type check inside the loop because otherwise
it's only looking at the last parameter