tail call has bug