Fixing #error and ?error handling in popup