few internal structure fixes