Fix a bug in registers and further improve servlet