More defensive programming fixing some IE10 bugs