Fix permission check

#16