Fix logical if on file check
Fix a few bugs in install scrip