Raise record not found instead of a runtime error. Fixes #428