fixed the already sent headers problem