Check limit's ctype in GET request, fixes #4710.
Check if reference exists, fixes #5328