Fix #20, #21, #22, #23, #25, #26 and #28