Added more permission detection