Retyped lxlee1102's fix for #11