Fix frame incorrectly showing in some cases