Backported to older Erlang versions.