bug where res is undefined @brianr