fix bug found by dialyzer