almost fixed the check, only one tiny bug left (need to click twice to proceed)