Better fix for #2476

@jvennix-r7 has plenty author credit to join the metasploit.com for serious.