Fixed ID generation bug

Was modding the nextval() output by id_bits instead of ids. This would cause the ID values to wrap prematurely and potentially create duplicate IDs.