bug fix: prevent ajax when it is not needed