Category injection some bugfix and refactor