Improved licence detection