remove reliance on lastchildelement which is broken in IE < 9