chmod added + minor fixes