Fixed a bug where permission were checked to soon.