added fixes and tests for category folder generation