Backport IE11 fixes to 1.7

This pull request is intended to replace #54 which contained too many fixes not directly related to IE11 support.