change sr to NULL and change code