almost working with mongoose... some problems with middleware