Make code compatible with Erlang versions older than R16B

`integer_to_binary/1` isn't available in Erlang versions older than R16B.