fixed registration middleware issue