a bit fixup and improvement