some enhancement and fixes