Fix small bug and fix test