fixed indentation
fixed pointer invalidity issue