[issue-305] Improve condition logic