bug fixes - intermediate