fix lots of bugs and change the content of warnimg message.