Thanks to all of you! GrandFather was correct, I did a silly mistake in building the hash, so a small (but crucial) part of the ID was not included, thus no key could be found afterwards... It's a good practice to write the example code to post to the forum, indeed!
Thank you!