Fix a bug in the ResponseWriter instantiation, and add a test