add object management, fix some issues
merge code