added some small fixes and functions in rc.lua