Issue 379

Fix #379 
Fix #388 
@fjarrett Please test and review