Add test + fix small bug