Do not crash if the User agent is empty, fix #1. Log an error in case of server side crash, partial fix of #3.