Fix permission checks