fix permission script bug and print meaningful output in the script, addresses #20