fixed some bits for generic implementation