created rbag and fixed some bugs
merge main
make it compile after merge