made key match its decimal equivalent and fixed bug in S