added a minor if clause