fix 501 condition