Fixing depth ordering bug