Fixed missing includes and invalid replacement.