Changed sctipt for better handling message warnings