Fixed the error of cannot read property of null for Chrome