bug fixes with clearing