Import BSS wrapper URL handling and fix some bugs