fixed #416 - allocate device