more random bug fixes