Several bug fixes (dictionaries, etc). Closes #13, #27, #33 and #35