Fixing slave code