more updates
 fixed minor bug, more robust
 fixed major bug, more robust
fixed minor bugs