Fixed lots of issues

Solved issues #144, #102, #153, #146, #158