adding permissions check
adding stack trace