3G library: Various fixes and enhancements