Fix #305
Fix #308
Fix #307
Remove ending line