Fix functions for switching to main iframe