Fix build problem on MSVC, and accidental use of delete instead of delete[].