added fail key and updated unit tests