fix several bugs and add anti-iframe code