fix getElementWidth
fix loop
fix loop