Bug fixes for previous fix.