Fix bug in getById. Return null if record not found