Fix bug in paramter name and added test to catch both branches