fixing bugs with multi-gpu support. mac build.