p_top should be pos at lines 376, 377