Fix bug 271 and 273