Fixed peek function