lots of updates for bug fixing