added a switch page check