Fixing issue of Warning: Cannot modify header information.