Basic bug fixes