found some subtle bugs