some unit tests and bug fixes
added security