improvement for checking timeout