fixing viewport and threshlod