Solve some errors with malloc in workspace