Initial bug fixes