stop p function is working fine