Fix up BG_Alloc (debug mode): should call memset().
Merge branch 'master' into resources