corrected script to work on case-sensitive OSes