fixed settop function