Finished fixing cases involving non-existent categories. Added test case to verify.