Fixed JS error that occurs when table overlap