merged old-version bug fixes to master