BUG fix and other improvments