Fix if statement and pass default parameter to method