almost fixed popup bug