fixed "headers already send" - bug