Fix build bug and return type for create_device