Update tests and fix bug after buggy PR