fixed unreliable implementation