Fix an MSIE crash, also fix an incorrectly placed if statement.