solved issues #166, #165, #162, #159