Fixed id auto-generation in models