various bug fixes;