change undefined check for permission level