refine code, compatible with IE, hopefully