Fix #274

Fix #274 and replace #310