Fix memory issue in apache module