Fix #1 and resolve #4