[IMP]Improved warning message and added condition for write state.