Fixing signature R and S value encoding, add tests for it