Fixed undeclared variable issue in /buckets/:bucket