refactoring warning of insecure access and adding tests

before:
1 passed, 12 deselected in 218.41 seconds

after:
1 passed, 12 deselected in 3.42 seconds