Improve flag checking.
Fix case sensitivy in access list.