final. bugs fixed