Fix device creation bug