fixed the script for POSIX systems