fixed bug with category locals write