Fixed #528, fixed device creation