updated script
improved error message