tie code and fixes