rework hash keys references management:
 - thread-safety
 - added more thread tests
 - use single magic to hold keys data, use XSANY only for single-threaded pers