make bookmarklet more robust