fixed a javascript error caused by lazy generation of page