Add manual test and fix a bug