Fix slave memory allocation
Merge branch 'master' into slave