some fixes
final version