fixed reference implementation