Fixing bug in hybrid script