Improved URL handling and other fixes