bug fixes for nil port