Some small fixes, acounting for non-existing values