fix some weird bugs