Resubmitting various bug fixes