Various fixes (md5, sha1 creation in mysql to avoid encoding issues), improvements in queries etc.