some bugs fixed. updates to help debugging