change new to malloc for wximage, fixed some vlas, should improve portability