added debug if's