fixing warnings
fix malloc error