corrected what seems to be a large implementation bug