fixed some bugs, consinstency and #96