request handler registration and fixing type errors.