Fix for #151,#146 ,#130, #107, #109, #58, #140 and #145