fixed bug and little refactor of https://github.com/globaleaks/GlobaLeaks/issues/757