Fix for when xhr is undefined