Improved tests

Added resilience tests and improved other test a bit more. Ran the test in
t.pl and got a PASS.