Fixed substr issue with IE