Fixed verification bug and added tests