some fixes to the initial implementation