fix for python 3.3
add test for replay attack