Patch for #491

Fix for issue #491, a bug in the permissions system.