misc code improve