script to detect negative values