Fix pdf download bug