- improve Type detection logic
- fix IE7 parse error