Fixed a bug and added a functional test