OP..
You have to be patient! Your kid is a kid, so she will mature as time goes on.
Also, you may wanna see if you and your ex can be on better terms. Your attitude towards her may rub off in your kid or like you said, if your ex is on some weird shyt, then that could also affect your child.
If your child get out of pocket, then as a parent, you can check her. Just explain why her actions isn't acceptable and let her know that discipline may come about, if necessary.
Other than that, be patient and go from there..