Fixed #528, fixed device creation

closes #528