set client header done and response closed if error page
remove unused cast VALUE
remove 'register'