problem with encode(decode(int val)) solved, tests work