Update the fix for the 509 bug described in #47 so it does not run on other errors

Conditions are (when version < 510 and error actually exists).
This prevents the 509 error handling from running and breaking
on other libmagic error like mime-encoding detection for empty or
1-byte file using buffer (see more in the reported issues).