Setting ern and id causing problems