Improve dom compatibility