bug fixes with new code