some fixes (but it is still buggy)