[FIX]Checked whether mode is not readonly and changed code according to jslint