Fix bug and add very basic test