Fixing js for category picker; adding checks for published