fixed my mistake on the if statements for apicalls