Now returns permission error when necessary.

My first pull request :P

This relates to #5