Dev

Several bug fixes.