Old code causing bugs