fix model associations to custom primary keys

fixed the associations to work with custom primary keys, other small fixes