some fixes but still halfbroken